/**
 * Created by 邓城平 on 2020/7/31.
 */
function animate(obj, target, callback) {
    console.log('lll');
    console.log(obj.offsetLeft);
    clearInterval(obj.timer);
    obj.timer = setInterval(function () {
        var step = (target - obj.offsetLeft) / 10;
        step = step > 0 ? Math.ceil(step) : Math.floor(step);
        if (obj.offsetLeft == target) {
            clearInterval(obj.timer);
            /*
                        if (callback) {
                            callback();
                        }
            */
            callback && callback();
        } else {
            obj.style.left = obj.offsetLeft + step + 'px';
        }
    }, 30)
}